/*******************************************************************************
 * This file is part of blueprint4j www.blueprint4j.org.
 * 
 *     blueprint4j is free software: you can redistribute it and/or modify
 *     it under the terms of the GNU Lesser General Public License as published by
 *     the Free Software Foundation, either version 3 of the License, or
 *     (at your option) any later version.
 * 
 *     blueprint4j is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU Lesser General Public License for more details.
 * 
 *     You should have received a copy of the GNU Lesser General Public License
 *     along with blueprint4j. If not, see <http://www.gnu.org/licenses/>.
 ******************************************************************************/
package blueprint4j.db;

import java.util.*;
import java.text.*;

public class DateTimeRange {

	private Date from_date = null;
	private Date to_date = null;
	private SimpleDateFormat simple_date_format = new SimpleDateFormat("yyyyMMdd");
	
	public DateTimeRange(Date p_from_date,Date p_to_date) {
		from_date =p_from_date;
		to_date = p_to_date;
	}	
	
	public Date getFromDate() {
		return from_date;
	}
	
	public Date getToDate() {
		return to_date;
	}
	
	public boolean isDayValid(Date p_date) {
		if (to_date == null) {
			return from_date.getTime() < p_date.getTime();
		}
		return (p_date.getTime() >= from_date.getTime() && p_date.getTime() <= to_date.getTime());  
	}
}
